/***************************************************************************
 *   KShootout - online shootout card game.                                *
 *   Copyright (C) 2008, 2009  MacJariel                                   *
 *                                                                         *
 *   KShootout is free software: you can redistribute it and/or modify     *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation, either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   KShootout is distributed in the hope that it will be useful,          *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with KShootout.  If not, see <http://www.gnu.org/licenses/>.    *
 ***************************************************************************/

#include "cardpocketwidget.h"
#include "cardwidget.h"
#include "cardwidgetsizemgr.h"

using namespace client;

CardPocketWidget::CardPocketWidget(QWidget *parent, bool isRevealed):
        QFrame(parent),
        m_isRevealed(isRevealed),
        m_pocketType(POCKET_INVALID),
        m_ownerId(0),
        m_cardSizeRole(CSR_Normal),
        mp_gameActionMgr(0)
{
    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    connect(CardWidgetSizeMgr::instance(), SIGNAL(cardSizeChanged()),
            this, SLOT(updateSize()));
    updateSize();
}

CardPocketWidget::~CardPocketWidget()
{
}

/* virtual */
void CardPocketWidget::push(CardWidget* cardWidget)
{
    cardWidget->setOwnerId(m_ownerId);
    cardWidget->setPocketType(m_pocketType);
}

/* virtual */
void CardPocketWidget::updateSize()
{
    updateGeometry();
}